GBML manual / Rooms

world_remember

Marks this thing as done in the world: the world remembers it for good. A chest that has been opened, a gate that has been unlocked. It only does something for a thing placed in a world with "Remembered in the world" turned on. world_remember(false) takes the mark off again.

Syntax

world_remember(on = true)

Arguments

NameType
onbool (can be left out; then it is true)

Returns

Nothing.

Description

Tells the world to remember this thing as done: a chest that has been opened, a gate that has been unlocked, a lever that has been pulled. The world keeps the mark for good, so when the player walks far away and comes back (or saves, switches the game off and plays again) the thing is still done.

It only does something for a thing you placed in a world with Remembered in the world turned on. For any other instance (one your code made, or one placed without that box ticked) it does nothing.

world_remember(false) takes the mark off again, for a thing that can be undone (a door that can be locked again).

You do not need this call for a thing that simply goes away. Destroying a Remembered thing marks it done by itself, so a coin that is picked up with instance_destroy stays picked up. This call is for things that stay in the world and change.

What the world does with the mark when it makes the thing again:

The marks are saved with the game when you call save_commit, and a new game (save_clear) forgets them all.

Example

if (opened == 0 && dist_to(x, y, other_x, other_y) < 12) {
    opened = 1;
    world_remember();
}

The chest opens when the player is close, and the world remembers it.

On the GBA

The world keeps one bit for each Remembered thing, and the bits are saved with the game (save_commit) and given up by save_clear. Destroying a Remembered thing marks it too, without calling this. What the world does with the mark when the part of the world holding the thing is made again: a thing whose code never asks world_remembered() is simply not made again once it is marked, so a pickup that was taken stays taken; a thing whose code asks world_remembered() is always made again, and asks for itself, so a chest can show itself open. Does nothing for a thing that is not a Remembered thing of a world (one made by code, say).

See also: world_rememberedWhat a world remembersinstance_destroy